package com.moregold.mvvmlib.exception

import com.moregold.mvvmlib.ext.parseErrorString
import java.lang.Exception

class AppException : Exception {

    var errorMsg: String

    constructor(error: String?): super(){
        errorMsg = error ?: parseError(null)
    }

    constructor(throwable: Throwable?): super(){
        errorMsg = parseError(throwable)
    }

    private fun parseError(throwable: Throwable?): String {
        return throwable.parseErrorString()
    }
}